﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;

namespace DAO
{
    public class LoaiHangXeDao
    {
        public IEnumerable<LOAIHANGXE> LoaiHangXe()
        {
            DoixeDataContext TV = new DoixeDataContext();
            return TV.LOAIHANGXEs;
        }
        public int LayMaLoaiHangXe(string TenHangXe)
        {
            DoixeDataContext TV = new DoixeDataContext();
            IEnumerable<LOAIHANGXE> lhDto;
            lhDto = from lh in TV.LOAIHANGXEs where lh.TenHang == TenHangXe select lh;
            if (lhDto.Count() == 0)
            {
                return -1;
            }
            return lhDto.Single().MaHangXe;
        }
    }
}
